package com.example.nonacademic_education.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.example.nonacademic_education.data.request.GrantR;
import com.example.nonacademic_education.service.impl.AuthorityServiceImpl;
import com.example.nonacademic_education.util.R;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("authority")
public class AuthorityController {
    @Resource
    private AuthorityServiceImpl authorityService;
    //@GetMapping("getAll")
    public R getAll() {
        return authorityService.getAll();
    }
    @SaCheckPermission("admin.grant")
    @PutMapping("updateGrant")
    public R updateGrant(@RequestBody GrantR grantR) {
        return authorityService.updateGrant(grantR);
    }
    @SaCheckPermission("admin.query")
    @GetMapping("getOneAuthority")
    public R getOneAuthority(Long id) {
        return authorityService.getOneAuthority(id);
    }
}
